package actionscript
{
	import flash.events.MouseEvent;
	
	import skins.ASSkin;
	
	import spark.components.supportClasses.SkinnableComponent;
	
	[SkinState("whatever")]
	[SkinState("somethingElse")]
	
	public class StatefulExample extends SkinnableComponent
	{
		private var _skinState:String = "whatever";

		protected override function getCurrentSkinState():String
		{
			return this._skinState;
		}
		
		public function StatefulExample()
		{
			super();
			super.setStyle("skinClass", ASSkin);
			super.addEventListener(MouseEvent.CLICK, this.clickHandler);
		}
		
		private function clickHandler(event:MouseEvent):void
		{
			if (this._skinState == "whatever")
				this._skinState = "somethingElse";
			else this._skinState = "whatever";
			super.invalidateSkinState();
		}
	}
}